package com.zx.controller;


import com.zx.common.TableId;
import com.zx.service.IGoodsService;
import com.zx.vo.DeductGoodsInventory;
import com.zx.vo.SimpleGoodsInfo;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/goods")
public class GoodsController {

    @Resource
    private IGoodsService goodsService;

    @PostMapping("/get-simple-goods")
    public List<SimpleGoodsInfo> getSimpleGoodsInfos(@RequestBody TableId tableId){
        return goodsService.getSimpleGoodsInfoByTableId(tableId);
    }

    @PostMapping("/deduct-goods-inventory")
    public Boolean deductGoodsInventory(@RequestBody List<DeductGoodsInventory> goodsInventories){
        return goodsService.deductGoodsInventory(goodsInventories);
    }

}
